3.2.71 \(\int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx\) [171]

3.2.71.1 Optimal result
3.2.71.2 Mathematica [A] (verified)
3.2.71.3 Rubi [A] (verified)
3.2.71.4 Maple [A] (verified)
3.2.71.5 Fricas [B] (verification not implemented)
3.2.71.6 Sympy [B] (verification not implemented)
3.2.71.7 Maxima [B] (verification not implemented)
3.2.71.8 Giac [A] (verification not implemented)
3.2.71.9 Mupad [B] (verification not implemented)

3.2.71.1 Optimal result

Integrand size = 23, antiderivative size = 59 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {x}{a+b}+\frac {a^{3/2} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{b^{3/2} (a+b) d}-\frac {\tanh (c+d x)}{b d} \]

output
x/(a+b)+a^(3/2)*arctan(b^(1/2)*tanh(d*x+c)/a^(1/2))/b^(3/2)/(a+b)/d-tanh(d 
*x+c)/b/d
 
3.2.71.2 Mathematica [A] (verified)

Time = 0.24 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.12 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {c+d x}{(a+b) d}+\frac {a^{3/2} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{b^{3/2} (a+b) d}-\frac {\tanh (c+d x)}{b d} \]

input
Integrate[Tanh[c + d*x]^4/(a + b*Tanh[c + d*x]^2),x]
 
output
(c + d*x)/((a + b)*d) + (a^(3/2)*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/ 
(b^(3/2)*(a + b)*d) - Tanh[c + d*x]/(b*d)
 
3.2.71.3 Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.17, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4153, 381, 397, 218, 219}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (i c+i d x)^4}{a-b \tan (i c+i d x)^2}dx\)

\(\Big \downarrow \) 4153

\(\displaystyle \frac {\int \frac {\tanh ^4(c+d x)}{\left (1-\tanh ^2(c+d x)\right ) \left (b \tanh ^2(c+d x)+a\right )}d\tanh (c+d x)}{d}\)

\(\Big \downarrow \) 381

\(\displaystyle \frac {\frac {\int \frac {a-(a-b) \tanh ^2(c+d x)}{\left (1-\tanh ^2(c+d x)\right ) \left (b \tanh ^2(c+d x)+a\right )}d\tanh (c+d x)}{b}-\frac {\tanh (c+d x)}{b}}{d}\)

\(\Big \downarrow \) 397

\(\displaystyle \frac {\frac {\frac {a^2 \int \frac {1}{b \tanh ^2(c+d x)+a}d\tanh (c+d x)}{a+b}+\frac {b \int \frac {1}{1-\tanh ^2(c+d x)}d\tanh (c+d x)}{a+b}}{b}-\frac {\tanh (c+d x)}{b}}{d}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {\frac {b \int \frac {1}{1-\tanh ^2(c+d x)}d\tanh (c+d x)}{a+b}+\frac {a^{3/2} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}}{b}-\frac {\tanh (c+d x)}{b}}{d}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {\frac {\frac {a^{3/2} \arctan \left (\frac {\sqrt {b} \tanh (c+d x)}{\sqrt {a}}\right )}{\sqrt {b} (a+b)}+\frac {b \text {arctanh}(\tanh (c+d x))}{a+b}}{b}-\frac {\tanh (c+d x)}{b}}{d}\)

input
Int[Tanh[c + d*x]^4/(a + b*Tanh[c + d*x]^2),x]
 
output
(((a^(3/2)*ArcTan[(Sqrt[b]*Tanh[c + d*x])/Sqrt[a]])/(Sqrt[b]*(a + b)) + (b 
*ArcTanh[Tanh[c + d*x]])/(a + b))/b - Tanh[c + d*x]/b)/d
 

3.2.71.3.1 Defintions of rubi rules used

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 381
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[e^3*(e*x)^(m - 3)*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q 
+ 1)/(b*d*(m + 2*(p + q) + 1))), x] - Simp[e^4/(b*d*(m + 2*(p + q) + 1)) 
Int[(e*x)^(m - 4)*(a + b*x^2)^p*(c + d*x^2)^q*Simp[a*c*(m - 3) + (a*d*(m + 
2*q - 1) + b*c*(m + 2*p - 1))*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, p, q 
}, x] && NeQ[b*c - a*d, 0] && GtQ[m, 3] && IntBinomialQ[a, b, c, d, e, m, 2 
, p, q, x]
 

rule 397
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ 
Symbol] :> Simp[(b*e - a*f)/(b*c - a*d)   Int[1/(a + b*x^2), x], x] - Simp[ 
(d*e - c*f)/(b*c - a*d)   Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e 
, f}, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4153
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], 
 x]}, Simp[c*(ff/f)   Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f 
f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, 
n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio 
nalQ[n]))
 
3.2.71.4 Maple [A] (verified)

Time = 0.14 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.47

method result size
derivativedivides \(\frac {-\frac {\tanh \left (d x +c \right )}{b}+\frac {a^{2} \arctan \left (\frac {b \tanh \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a +b \right ) b \sqrt {a b}}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right )}{2 a +2 b}+\frac {\ln \left (\tanh \left (d x +c \right )+1\right )}{2 a +2 b}}{d}\) \(87\)
default \(\frac {-\frac {\tanh \left (d x +c \right )}{b}+\frac {a^{2} \arctan \left (\frac {b \tanh \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a +b \right ) b \sqrt {a b}}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right )}{2 a +2 b}+\frac {\ln \left (\tanh \left (d x +c \right )+1\right )}{2 a +2 b}}{d}\) \(87\)
risch \(\frac {x}{a +b}+\frac {2}{b d \left ({\mathrm e}^{2 d x +2 c}+1\right )}+\frac {\sqrt {-a b}\, a \ln \left ({\mathrm e}^{2 d x +2 c}+\frac {2 \sqrt {-a b}+a -b}{a +b}\right )}{2 b^{2} \left (a +b \right ) d}-\frac {\sqrt {-a b}\, a \ln \left ({\mathrm e}^{2 d x +2 c}-\frac {2 \sqrt {-a b}-a +b}{a +b}\right )}{2 b^{2} \left (a +b \right ) d}\) \(131\)

input
int(tanh(d*x+c)^4/(a+b*tanh(d*x+c)^2),x,method=_RETURNVERBOSE)
 
output
1/d*(-1/b*tanh(d*x+c)+1/(a+b)/b*a^2/(a*b)^(1/2)*arctan(b*tanh(d*x+c)/(a*b) 
^(1/2))-1/(2*a+2*b)*ln(tanh(d*x+c)-1)+1/(2*a+2*b)*ln(tanh(d*x+c)+1))
 
3.2.71.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 225 vs. \(2 (51) = 102\).

Time = 0.29 (sec) , antiderivative size = 777, normalized size of antiderivative = 13.17 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\left [\frac {2 \, b d x \cosh \left (d x + c\right )^{2} + 4 \, b d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + 2 \, b d x \sinh \left (d x + c\right )^{2} + 2 \, b d x + {\left (a \cosh \left (d x + c\right )^{2} + 2 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a \sinh \left (d x + c\right )^{2} + a\right )} \sqrt {-\frac {a}{b}} \log \left (\frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a^{2} + 2 \, a b + b^{2}\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a^{2} - b^{2}\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{2} + a^{2} - b^{2}\right )} \sinh \left (d x + c\right )^{2} + a^{2} - 6 \, a b + b^{2} + 4 \, {\left ({\left (a^{2} + 2 \, a b + b^{2}\right )} \cosh \left (d x + c\right )^{3} + {\left (a^{2} - b^{2}\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + 4 \, {\left ({\left (a b + b^{2}\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (a b + b^{2}\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a b + b^{2}\right )} \sinh \left (d x + c\right )^{2} + a b - b^{2}\right )} \sqrt {-\frac {a}{b}}}{{\left (a + b\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a + b\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a - b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} \cosh \left (d x + c\right )^{2} + a - b\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{3} + {\left (a - b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + a + b}\right ) + 4 \, a + 4 \, b}{2 \, {\left ({\left (a b + b^{2}\right )} d \cosh \left (d x + c\right )^{2} + 2 \, {\left (a b + b^{2}\right )} d \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a b + b^{2}\right )} d \sinh \left (d x + c\right )^{2} + {\left (a b + b^{2}\right )} d\right )}}, \frac {b d x \cosh \left (d x + c\right )^{2} + 2 \, b d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + b d x \sinh \left (d x + c\right )^{2} + b d x + {\left (a \cosh \left (d x + c\right )^{2} + 2 \, a \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + a \sinh \left (d x + c\right )^{2} + a\right )} \sqrt {\frac {a}{b}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a + b\right )} \sinh \left (d x + c\right )^{2} + a - b\right )} \sqrt {\frac {a}{b}}}{2 \, a}\right ) + 2 \, a + 2 \, b}{{\left (a b + b^{2}\right )} d \cosh \left (d x + c\right )^{2} + 2 \, {\left (a b + b^{2}\right )} d \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + {\left (a b + b^{2}\right )} d \sinh \left (d x + c\right )^{2} + {\left (a b + b^{2}\right )} d}\right ] \]

input
integrate(tanh(d*x+c)^4/(a+b*tanh(d*x+c)^2),x, algorithm="fricas")
 
output
[1/2*(2*b*d*x*cosh(d*x + c)^2 + 4*b*d*x*cosh(d*x + c)*sinh(d*x + c) + 2*b* 
d*x*sinh(d*x + c)^2 + 2*b*d*x + (a*cosh(d*x + c)^2 + 2*a*cosh(d*x + c)*sin 
h(d*x + c) + a*sinh(d*x + c)^2 + a)*sqrt(-a/b)*log(((a^2 + 2*a*b + b^2)*co 
sh(d*x + c)^4 + 4*(a^2 + 2*a*b + b^2)*cosh(d*x + c)*sinh(d*x + c)^3 + (a^2 
 + 2*a*b + b^2)*sinh(d*x + c)^4 + 2*(a^2 - b^2)*cosh(d*x + c)^2 + 2*(3*(a^ 
2 + 2*a*b + b^2)*cosh(d*x + c)^2 + a^2 - b^2)*sinh(d*x + c)^2 + a^2 - 6*a* 
b + b^2 + 4*((a^2 + 2*a*b + b^2)*cosh(d*x + c)^3 + (a^2 - b^2)*cosh(d*x + 
c))*sinh(d*x + c) + 4*((a*b + b^2)*cosh(d*x + c)^2 + 2*(a*b + b^2)*cosh(d* 
x + c)*sinh(d*x + c) + (a*b + b^2)*sinh(d*x + c)^2 + a*b - b^2)*sqrt(-a/b) 
)/((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a 
+ b)*sinh(d*x + c)^4 + 2*(a - b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh(d*x + 
 c)^2 + a - b)*sinh(d*x + c)^2 + 4*((a + b)*cosh(d*x + c)^3 + (a - b)*cosh 
(d*x + c))*sinh(d*x + c) + a + b)) + 4*a + 4*b)/((a*b + b^2)*d*cosh(d*x + 
c)^2 + 2*(a*b + b^2)*d*cosh(d*x + c)*sinh(d*x + c) + (a*b + b^2)*d*sinh(d* 
x + c)^2 + (a*b + b^2)*d), (b*d*x*cosh(d*x + c)^2 + 2*b*d*x*cosh(d*x + c)* 
sinh(d*x + c) + b*d*x*sinh(d*x + c)^2 + b*d*x + (a*cosh(d*x + c)^2 + 2*a*c 
osh(d*x + c)*sinh(d*x + c) + a*sinh(d*x + c)^2 + a)*sqrt(a/b)*arctan(1/2*( 
(a + b)*cosh(d*x + c)^2 + 2*(a + b)*cosh(d*x + c)*sinh(d*x + c) + (a + b)* 
sinh(d*x + c)^2 + a - b)*sqrt(a/b)/a) + 2*a + 2*b)/((a*b + b^2)*d*cosh(d*x 
 + c)^2 + 2*(a*b + b^2)*d*cosh(d*x + c)*sinh(d*x + c) + (a*b + b^2)*d*s...
 
3.2.71.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 428 vs. \(2 (48) = 96\).

Time = 4.76 (sec) , antiderivative size = 428, normalized size of antiderivative = 7.25 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\begin {cases} \tilde {\infty } x \tanh ^{2}{\left (c \right )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x - \frac {\tanh ^{3}{\left (c + d x \right )}}{3 d} - \frac {\tanh {\left (c + d x \right )}}{d}}{a} & \text {for}\: b = 0 \\\frac {x - \frac {\tanh {\left (c + d x \right )}}{d}}{b} & \text {for}\: a = 0 \\\frac {3 d x \tanh ^{2}{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} - \frac {3 d x}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} - \frac {2 \tanh ^{3}{\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} + \frac {3 \tanh {\left (c + d x \right )}}{2 b d \tanh ^{2}{\left (c + d x \right )} - 2 b d} & \text {for}\: a = - b \\\frac {x \tanh ^{4}{\left (c \right )}}{a + b \tanh ^{2}{\left (c \right )}} & \text {for}\: d = 0 \\\frac {a^{2} \log {\left (- \sqrt {- \frac {a}{b}} + \tanh {\left (c + d x \right )} \right )}}{2 a b^{2} d \sqrt {- \frac {a}{b}} + 2 b^{3} d \sqrt {- \frac {a}{b}}} - \frac {a^{2} \log {\left (\sqrt {- \frac {a}{b}} + \tanh {\left (c + d x \right )} \right )}}{2 a b^{2} d \sqrt {- \frac {a}{b}} + 2 b^{3} d \sqrt {- \frac {a}{b}}} - \frac {2 a b \sqrt {- \frac {a}{b}} \tanh {\left (c + d x \right )}}{2 a b^{2} d \sqrt {- \frac {a}{b}} + 2 b^{3} d \sqrt {- \frac {a}{b}}} + \frac {2 b^{2} d x \sqrt {- \frac {a}{b}}}{2 a b^{2} d \sqrt {- \frac {a}{b}} + 2 b^{3} d \sqrt {- \frac {a}{b}}} - \frac {2 b^{2} \sqrt {- \frac {a}{b}} \tanh {\left (c + d x \right )}}{2 a b^{2} d \sqrt {- \frac {a}{b}} + 2 b^{3} d \sqrt {- \frac {a}{b}}} & \text {otherwise} \end {cases} \]

input
integrate(tanh(d*x+c)**4/(a+b*tanh(d*x+c)**2),x)
 
output
Piecewise((zoo*x*tanh(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ((x - tanh(c 
 + d*x)**3/(3*d) - tanh(c + d*x)/d)/a, Eq(b, 0)), ((x - tanh(c + d*x)/d)/b 
, Eq(a, 0)), (3*d*x*tanh(c + d*x)**2/(2*b*d*tanh(c + d*x)**2 - 2*b*d) - 3* 
d*x/(2*b*d*tanh(c + d*x)**2 - 2*b*d) - 2*tanh(c + d*x)**3/(2*b*d*tanh(c + 
d*x)**2 - 2*b*d) + 3*tanh(c + d*x)/(2*b*d*tanh(c + d*x)**2 - 2*b*d), Eq(a, 
 -b)), (x*tanh(c)**4/(a + b*tanh(c)**2), Eq(d, 0)), (a**2*log(-sqrt(-a/b) 
+ tanh(c + d*x))/(2*a*b**2*d*sqrt(-a/b) + 2*b**3*d*sqrt(-a/b)) - a**2*log( 
sqrt(-a/b) + tanh(c + d*x))/(2*a*b**2*d*sqrt(-a/b) + 2*b**3*d*sqrt(-a/b)) 
- 2*a*b*sqrt(-a/b)*tanh(c + d*x)/(2*a*b**2*d*sqrt(-a/b) + 2*b**3*d*sqrt(-a 
/b)) + 2*b**2*d*x*sqrt(-a/b)/(2*a*b**2*d*sqrt(-a/b) + 2*b**3*d*sqrt(-a/b)) 
 - 2*b**2*sqrt(-a/b)*tanh(c + d*x)/(2*a*b**2*d*sqrt(-a/b) + 2*b**3*d*sqrt( 
-a/b)), True))
 
3.2.71.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 509 vs. \(2 (51) = 102\).

Time = 0.39 (sec) , antiderivative size = 509, normalized size of antiderivative = 8.63 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=-\frac {{\left (a - b\right )} \log \left ({\left (a + b\right )} e^{\left (4 \, d x + 4 \, c\right )} + 2 \, {\left (a - b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a + b\right )}{8 \, {\left (a b + b^{2}\right )} d} + \frac {{\left (a - b\right )} \log \left (2 \, {\left (a - b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + {\left (a + b\right )} e^{\left (-4 \, d x - 4 \, c\right )} + a + b\right )}{8 \, {\left (a b + b^{2}\right )} d} + \frac {{\left (a^{2} - 6 \, a b + b^{2}\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{16 \, {\left (a b + b^{2}\right )} \sqrt {a b} d} + \frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{4 \, \sqrt {a b} b d} - \frac {{\left (a^{2} - 6 \, a b + b^{2}\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{16 \, {\left (a b + b^{2}\right )} \sqrt {a b} d} - \frac {3 \, {\left (a + b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{8 \, \sqrt {a b} b d} - \frac {{\left (a - b\right )} \arctan \left (\frac {{\left (a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{4 \, \sqrt {a b} b d} - \frac {\log \left ({\left (a + b\right )} e^{\left (4 \, d x + 4 \, c\right )} + 2 \, {\left (a - b\right )} e^{\left (2 \, d x + 2 \, c\right )} + a + b\right )}{4 \, b d} + \frac {\log \left (2 \, {\left (a - b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + {\left (a + b\right )} e^{\left (-4 \, d x - 4 \, c\right )} + a + b\right )}{4 \, b d} + \frac {3 \, \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}{4 \, b d} - \frac {3 \, \log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{4 \, b d} + \frac {5}{8 \, {\left (b e^{\left (2 \, d x + 2 \, c\right )} + b\right )} d} - \frac {11}{8 \, {\left (b e^{\left (-2 \, d x - 2 \, c\right )} + b\right )} d} \]

input
integrate(tanh(d*x+c)^4/(a+b*tanh(d*x+c)^2),x, algorithm="maxima")
 
output
-1/8*(a - b)*log((a + b)*e^(4*d*x + 4*c) + 2*(a - b)*e^(2*d*x + 2*c) + a + 
 b)/((a*b + b^2)*d) + 1/8*(a - b)*log(2*(a - b)*e^(-2*d*x - 2*c) + (a + b) 
*e^(-4*d*x - 4*c) + a + b)/((a*b + b^2)*d) + 1/16*(a^2 - 6*a*b + b^2)*arct 
an(1/2*((a + b)*e^(2*d*x + 2*c) + a - b)/sqrt(a*b))/((a*b + b^2)*sqrt(a*b) 
*d) + 1/4*(a - b)*arctan(1/2*((a + b)*e^(2*d*x + 2*c) + a - b)/sqrt(a*b))/ 
(sqrt(a*b)*b*d) - 1/16*(a^2 - 6*a*b + b^2)*arctan(1/2*((a + b)*e^(-2*d*x - 
 2*c) + a - b)/sqrt(a*b))/((a*b + b^2)*sqrt(a*b)*d) - 3/8*(a + b)*arctan(1 
/2*((a + b)*e^(-2*d*x - 2*c) + a - b)/sqrt(a*b))/(sqrt(a*b)*b*d) - 1/4*(a 
- b)*arctan(1/2*((a + b)*e^(-2*d*x - 2*c) + a - b)/sqrt(a*b))/(sqrt(a*b)*b 
*d) - 1/4*log((a + b)*e^(4*d*x + 4*c) + 2*(a - b)*e^(2*d*x + 2*c) + a + b) 
/(b*d) + 1/4*log(2*(a - b)*e^(-2*d*x - 2*c) + (a + b)*e^(-4*d*x - 4*c) + a 
 + b)/(b*d) + 3/4*log(e^(2*d*x + 2*c) + 1)/(b*d) - 3/4*log(e^(-2*d*x - 2*c 
) + 1)/(b*d) + 5/8/((b*e^(2*d*x + 2*c) + b)*d) - 11/8/((b*e^(-2*d*x - 2*c) 
 + b)*d)
 
3.2.71.8 Giac [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.47 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {\frac {a^{2} \arctan \left (\frac {a e^{\left (2 \, d x + 2 \, c\right )} + b e^{\left (2 \, d x + 2 \, c\right )} + a - b}{2 \, \sqrt {a b}}\right )}{{\left (a b + b^{2}\right )} \sqrt {a b}} + \frac {d x + c}{a + b} + \frac {2}{b {\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}}}{d} \]

input
integrate(tanh(d*x+c)^4/(a+b*tanh(d*x+c)^2),x, algorithm="giac")
 
output
(a^2*arctan(1/2*(a*e^(2*d*x + 2*c) + b*e^(2*d*x + 2*c) + a - b)/sqrt(a*b)) 
/((a*b + b^2)*sqrt(a*b)) + (d*x + c)/(a + b) + 2/(b*(e^(2*d*x + 2*c) + 1)) 
)/d
 
3.2.71.9 Mupad [B] (verification not implemented)

Time = 1.86 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.95 \[ \int \frac {\tanh ^4(c+d x)}{a+b \tanh ^2(c+d x)} \, dx=\frac {x}{a+b}-\frac {\mathrm {tanh}\left (c+d\,x\right )}{b\,d}+\frac {a^2\,\mathrm {atan}\left (\frac {b\,\mathrm {tanh}\left (c+d\,x\right )}{\sqrt {a\,b}}\right )}{b\,d\,\sqrt {a\,b}\,\left (a+b\right )} \]

input
int(tanh(c + d*x)^4/(a + b*tanh(c + d*x)^2),x)
 
output
x/(a + b) - tanh(c + d*x)/(b*d) + (a^2*atan((b*tanh(c + d*x))/(a*b)^(1/2)) 
)/(b*d*(a*b)^(1/2)*(a + b))